package com.zyy.meetObject;

public class person {
    //属性
    String name;
    private int age;
    char gender;

    //方法
    public void eat(){
        System.out.println("我在吃饭");
    }
    public void sleep(int hour){
        System.out.println("我要睡觉的时间" + hour + "小时");
    }
    public String interests(String hobby){
        String info = "我的爱好是" + hobby;
        System.out.println(info);
        return info;
    }
    public void setAge(int a){
        if(a >= 0 && a <= 130){
            age = a;
        }else{
            System.out.println("你输入的数据非法");
        }
    }
    public int getAge(){
        return age;
    }


}
